Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trussed abstraction and nkpk subcommand #500

Merged
merged 8 commits into from
Feb 1, 2024
Merged

Conversation

robin-nitrokey
Copy link
Member

This PR adds a new abstraction layer by extracting most of the functionality from the nk3 module to a trussed module and introduces the nkpk subcommand that uses this abstraction.

Currently available commands for nkpk:

  • list
  • provision fido2
  • reboot
  • rng
  • status
  • test
  • version

@daringer
Copy link
Collaborator

did some testing on this to find a regression, but nothing so far... nice!
tested with: nk3am + nk3an means mostly the nk3 and fido2 sub-commands - not yet tested with the nkpk

lgtm!

@sosthene-nitrokey
Copy link
Contributor

I get an error when doing nitropy ilst:

Critical error:
An unhandled exception occurred
	Exception encountered: AttributeError("'NoneType' object has no attribute 'device_name'")

It looks like the list method in cli/trussed/__init.py gets a None context.

@robin-nitrokey
Copy link
Member Author

Ah, good catch. That’s due to this ugly hack:

def _list():
fido2.commands["list"].callback()
start.commands["list"].callback()
nk3.commands["list"].callback()
nkpk.commands["list"].callback()

Maybe there is a typesafe replacement for this code.

@robin-nitrokey
Copy link
Member Author

Should be fixed now.

This patch introduces a pynitrokey.trussed module that contains the
functionality that is common for all Nitrokey devices using the Trussed
framework:  communication via CTAPHID, basic commands using admin-app
and provisioner-app, firmware updates using the Nitrokey container
format and the LPC55 and NRF52 bootloader implementations.
@robin-nitrokey robin-nitrokey merged commit 6f5c2c0 into master Feb 1, 2024
10 checks passed
@robin-nitrokey robin-nitrokey deleted the nkpk-trussed branch February 1, 2024 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants